﻿using System;
using System.Collections.Generic;
using TSites.GUI.Enums;
using System.Globalization;
using TSites.GUI.Languages;
using TSites.Offices;

namespace TSites.GUI.Entities
{
	public class AuditContractParam
	{
		public DateTime ContractDate { get; set; }
		public DateTime FinanYearEnd { get; set; }
		public double TotalFee { get; set; }
		public string TotalFeeString { get; set; }
		public string Description { get; set; }
		public List<AuditPaymentMethod> PaymentMethods { get; set; }
		public DateTime AuditorReport { get; set; }

		public void AddBookmarks(Dictionary<string, object> bookmarkHash, LANGUAGE language)
		{
			bookmarkHash = bookmarkHash ?? new Dictionary<string, object>();

			string contractDate, finanYearEnd, auditorReport;
			IFormatProvider formatProvider;
			if (language == LANGUAGE.Vietnames)
			{
				contractDate = GlobalConst.VNFormatDate(ContractDate);
				finanYearEnd = GlobalConst.VNFormatDate(FinanYearEnd);
				auditorReport = GlobalConst.VNFormatDate(AuditorReport);

				formatProvider = CultureInfoFactory.VIVNFormat;
			}
			else
			{
				contractDate = ContractDate.ToString(GlobalConst.EN_FORMAT_DATE);
				finanYearEnd = FinanYearEnd.ToString(GlobalConst.EN_FORMAT_DATE);
				auditorReport = AuditorReport.ToString(GlobalConst.EN_FORMAT_DATE);

				formatProvider = CultureInfoFactory.ENUSFormat;
			}
			
			bookmarkHash.Add("ContractDate", contractDate);
			bookmarkHash.Add("ContractYear", ContractDate.Year.ToString());
			bookmarkHash.Add("FinancialYearEnd", finanYearEnd);
			bookmarkHash.Add("TotalFee", TotalFee.ToString("N0", formatProvider));
			bookmarkHash.Add("TotalFeeString", TotalFeeString);
			bookmarkHash.Add("Description", Description);
			// method of payment
			bookmarkHash.Add("MethodOfPayment", PaymentMethods);
			bookmarkHash.Add("AuditorReport", auditorReport);
		}
	}
}
